package Controllers;

import Entities.BookList;
import Facades.BookListFacade;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

@ManagedBean(name = "bookListController")
@ViewScoped
public class BookListController extends AbstractController<BookList> implements Serializable {

    @EJB
    private BookListFacade ejbFacade;

    public BookListController() {
        super(BookList.class);
    }

    @PostConstruct
    public void init() {
        super.setFacade(ejbFacade);
    }

    @Override
    protected void setEmbeddableKeys() {
        this.getSelected().getBookListPK().setBookBorrowingidbookBorrowing(this.getSelected().getBookBorrowing().getIdbookBorrowing());
    }

    @Override
    protected void initializeEmbeddableKey() {
        this.getSelected().setBookListPK(new Entities.BookListPK());
    }
}
